11. 练习:MIN、MAX 与 AVG

问题:MIN、MAX 与 AVERAGE

根据 SQL 表格信息回答以下问题。如果你遇到问题或想要对比检查你的答案,可以在下一页面的顶部找到我的答案。

  1. 最早的订单下于何时?

  2. 尝试执行和第一个问题一样的查询,但是不使用聚合函数。

  3. 最近的 web_event 发生在什么时候?

  4. 尝试以另一种方式执行上个问题的查询,不使用聚合函数。

  5. 算出每个订单在每种纸张上消费的平均 ( AVERAGE ) 金额,以及每个订单针对每种纸张购买的平均数量。最终答案应该有 6 个值,每个纸张类型平均销量对应一个值,以及平均数量对应一个值。

  6. 我相信你都渴望知道在所有订单上消费的中值 total_usd 是多少?虽然这一概念已经超出我们的范围。注意,这比我们到目前为止介绍的基本内容要高深一点,但是我们可以按照以下方式对答案进行硬编码。

Workspace

This section contains either a workspace (it can be a Jupyter Notebook workspace or an online code editor work space, etc.) and it cannot be automatically downloaded to be generated here. Please access the classroom with your account and manually download the workspace to your local machine. Note that for some courses, Udacity upload the workspace files onto https://github.com/udacity , so you may be able to download them there.

Workspace Information:

  • Default file path:
  • Workspace type: sql-evaluator
  • Opened files (when workspace is loaded): n/a